package c.c.b.a.b.a.c;

import c.c.b.a.a.o;
import c.c.b.a.a.r;
import c.c.b.a.a.x;
import c.c.b.a.b.a.e;
import c.c.b.a.b.a.h.b;
import c.c.b.a.b.a.h.g;
import c.c.b.a.b.a.h.g.d;
import c.c.b.a.b.a.h.q;
import c.c.b.a.b.a0;
import c.c.b.a.b.c0;
import c.c.b.a.b.f;
import c.c.b.a.b.j;
import c.c.b.a.b.m;
import c.c.b.a.b.s;
import c.c.b.a.b.u;
import c.c.b.a.b.v;
import c.c.b.a.b.w;
import c.c.b.a.b.x.a;
import c.c.b.a.b.z;
import com.huawei.agconnect.exception.AGCServerException;
import java.io.IOException;
import java.lang.ref.Reference;
import java.net.ConnectException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.Socket;
import java.net.SocketException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLPeerUnverifiedException;

/* compiled from: RealConnection */
public final class c extends d {
    public final m b;
    public final f c;
    public Socket d;
    public Socket e;
    public u f;
    public a0 g;
    public g h;
    public c.c.b.a.a.g i;
    public c.c.b.a.a.f j;
    public boolean k;
    public int l;
    public int m = 1;
    public final List<Reference<g>> n = new ArrayList();
    public long o = Long.MAX_VALUE;

    public c(m mVar, f fVar) {
        this.b = mVar;
        this.c = fVar;
    }

    public void a(g gVar) {
        synchronized (this.b) {
            this.m = gVar.n();
        }
    }

    public void b(q qVar) throws IOException {
        qVar.a(b.REFUSED_STREAM);
    }

    public e.d c(z zVar, a aVar, g gVar) throws SocketException {
        if (this.h != null) {
            return new c.c.b.a.b.a.h.f(zVar, aVar, gVar, this.h);
        }
        e.g gVar2 = (e.g) aVar;
        this.e.setSoTimeout(gVar2.j);
        x a = this.i.a();
        long j = (long) gVar2.j;
        TimeUnit timeUnit = TimeUnit.MILLISECONDS;
        a.b(j, timeUnit);
        this.j.a().b((long) gVar2.k, timeUnit);
        return new c.c.b.a.b.a.g.a(zVar, gVar, this.i, this.j);
    }

    public final void d(int i, int i2, int i3, j jVar, s sVar) throws IOException {
        c0.a aVar = new c0.a();
        aVar.b(this.c.a.a);
        aVar.e("Host", e.g(this.c.a.a, true));
        v.a aVar2 = aVar.c;
        String str = "Proxy-Connection";
        String str2 = "Keep-Alive";
        aVar2.c(str, str2);
        aVar2.a(str);
        aVar2.a.add(str);
        aVar2.a.add(str2);
        aVar2 = aVar.c;
        str = "User-Agent";
        str2 = "okhttp/3.9.1";
        aVar2.c(str, str2);
        aVar2.a(str);
        aVar2.a.add(str);
        aVar2.a.add(str2);
        c0 h = aVar.h();
        w wVar = h.a;
        f(i, i2, jVar, sVar);
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("CONNECT ");
        stringBuilder.append(e.g(wVar, true));
        stringBuilder.append(" HTTP/1.1");
        String stringBuilder2 = stringBuilder.toString();
        c.c.b.a.a.g gVar = this.i;
        c.c.b.a.b.a.g.a aVar3 = new c.c.b.a.b.a.g.a(null, null, gVar, this.j);
        x a = gVar.a();
        long j = (long) i2;
        TimeUnit timeUnit = TimeUnit.MILLISECONDS;
        a.b(j, timeUnit);
        this.j.a().b((long) i3, timeUnit);
        aVar3.e(h.c, stringBuilder2);
        aVar3.d.flush();
        c.c.b.a.b.c.a a2 = aVar3.a(false);
        a2.a = h;
        c.c.b.a.b.c b = a2.b();
        long b2 = e.f.b(b);
        if (b2 == -1) {
            b2 = 0;
        }
        c.c.b.a.a.w f = aVar3.f(b2);
        e.v(f, Integer.MAX_VALUE, timeUnit);
        ((c.c.b.a.b.a.g.a.f) f).close();
        i2 = b.c;
        if (i2 != AGCServerException.OK) {
            if (i2 == 407) {
                Objects.requireNonNull(this.c.a.d);
                throw new IOException("Failed to authenticate with proxy");
            }
            StringBuilder g = c.b.a.a.a.g("Unexpected response code for CONNECT: ");
            g.append(b.c);
            throw new IOException(g.toString());
        } else if (!this.i.c().e() || !this.j.c().e()) {
            throw new IOException("TLS tunnel buffered too many bytes!");
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:73:? A:{SYNTHETIC, RETURN, ORIG_RETURN} */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x008f  */
    public void e(int r10, int r11, int r12, boolean r13, c.c.b.a.b.j r14, c.c.b.a.b.s r15) {
        /*
        r9 = this;
        r0 = r9.g;
        if (r0 != 0) goto L_0x010c;
    L_0x0004:
        r0 = r9.c;
        r0 = r0.a;
        r1 = r0.f;
        r2 = new c.c.b.a.b.a.c.b;
        r2.m873init(r1);
        r0 = r0.i;
        if (r0 != 0) goto L_0x004c;
    L_0x0013:
        r0 = c.c.b.a.b.n.g;
        r0 = r1.contains(r0);
        if (r0 == 0) goto L_0x003f;
    L_0x001b:
        r0 = r9.c;
        r0 = r0.a;
        r0 = r0.a;
        r0 = r0.d;
        r1 = c.c.b.a.b.a.i.e.a;
        r1 = r1.m(r0);
        if (r1 == 0) goto L_0x002c;
    L_0x002b:
        goto L_0x004c;
    L_0x002c:
        r10 = new c.c.b.a.b.a.c.e;
        r11 = new java.net.UnknownServiceException;
        r12 = "CLEARTEXT communication to ";
        r13 = " not permitted by network security policy";
        r12 = c.b.a.a.a.E(r12, r0, r13);
        r11.<init>(r12);
        r10.m876init(r11);
        throw r10;
    L_0x003f:
        r10 = new c.c.b.a.b.a.c.e;
        r11 = new java.net.UnknownServiceException;
        r12 = "CLEARTEXT communication not enabled for client";
        r11.<init>(r12);
        r10.m876init(r11);
        throw r10;
    L_0x004c:
        r0 = 0;
        r1 = r0;
    L_0x004e:
        r3 = r9.c;	 Catch:{ IOException -> 0x00a0 }
        r3 = r3.a();	 Catch:{ IOException -> 0x00a0 }
        if (r3 == 0) goto L_0x0064;
    L_0x0056:
        r3 = r9;
        r4 = r10;
        r5 = r11;
        r6 = r12;
        r7 = r14;
        r8 = r15;
        r3.d(r4, r5, r6, r7, r8);	 Catch:{ IOException -> 0x00a0 }
        r3 = r9.d;	 Catch:{ IOException -> 0x00a0 }
        if (r3 != 0) goto L_0x0067;
    L_0x0063:
        goto L_0x0071;
    L_0x0064:
        r9.f(r10, r11, r14, r15);	 Catch:{ IOException -> 0x00a0 }
    L_0x0067:
        r9.g(r2, r14, r15);	 Catch:{ IOException -> 0x00a0 }
        r3 = r9.c;	 Catch:{ IOException -> 0x00a0 }
        r3 = r3.c;	 Catch:{ IOException -> 0x00a0 }
        java.util.Objects.requireNonNull(r15);	 Catch:{ IOException -> 0x00a0 }
    L_0x0071:
        r10 = r9.c;
        r10 = r10.a();
        if (r10 == 0) goto L_0x008b;
    L_0x0079:
        r10 = r9.d;
        if (r10 == 0) goto L_0x007e;
    L_0x007d:
        goto L_0x008b;
    L_0x007e:
        r10 = new java.net.ProtocolException;
        r11 = "Too many tunnel connections attempted: 21";
        r10.<init>(r11);
        r11 = new c.c.b.a.b.a.c.e;
        r11.m876init(r10);
        throw r11;
    L_0x008b:
        r10 = r9.h;
        if (r10 == 0) goto L_0x009f;
    L_0x008f:
        r10 = r9.b;
        monitor-enter(r10);
        r11 = r9.h;	 Catch:{ all -> 0x009c }
        r11 = r11.n();	 Catch:{ all -> 0x009c }
        r9.m = r11;	 Catch:{ all -> 0x009c }
        monitor-exit(r10);	 Catch:{ all -> 0x009c }
        goto L_0x009f;
    L_0x009c:
        r11 = move-exception;
        monitor-exit(r10);	 Catch:{ all -> 0x009c }
        throw r11;
    L_0x009f:
        return;
    L_0x00a0:
        r3 = move-exception;
        r4 = r9.e;
        c.c.b.a.b.a.e.o(r4);
        r4 = r9.d;
        c.c.b.a.b.a.e.o(r4);
        r9.e = r0;
        r9.d = r0;
        r9.i = r0;
        r9.j = r0;
        r9.f = r0;
        r9.g = r0;
        r9.h = r0;
        r4 = r9.c;
        r4 = r4.c;
        java.util.Objects.requireNonNull(r15);
        r4 = 1;
        r5 = 0;
        if (r1 != 0) goto L_0x00ca;
    L_0x00c4:
        r1 = new c.c.b.a.b.a.c.e;
        r1.m876init(r3);
        goto L_0x00d9;
    L_0x00ca:
        r6 = r1.a;
        r7 = c.c.b.a.b.a.c.e.b;
        if (r7 == 0) goto L_0x00d7;
    L_0x00d0:
        r8 = new java.lang.Object[r4];	 Catch:{ IllegalAccessException | InvocationTargetException -> 0x00d7, IllegalAccessException | InvocationTargetException -> 0x00d7 }
        r8[r5] = r6;	 Catch:{ IllegalAccessException | InvocationTargetException -> 0x00d7, IllegalAccessException | InvocationTargetException -> 0x00d7 }
        r7.invoke(r3, r8);	 Catch:{ IllegalAccessException | InvocationTargetException -> 0x00d7, IllegalAccessException | InvocationTargetException -> 0x00d7 }
    L_0x00d7:
        r1.a = r3;
    L_0x00d9:
        if (r13 == 0) goto L_0x010b;
    L_0x00db:
        r2.d = r4;
        r6 = r2.c;
        if (r6 != 0) goto L_0x00e2;
    L_0x00e1:
        goto L_0x0107;
    L_0x00e2:
        r6 = r3 instanceof java.net.ProtocolException;
        if (r6 == 0) goto L_0x00e7;
    L_0x00e6:
        goto L_0x0107;
    L_0x00e7:
        r6 = r3 instanceof java.io.InterruptedIOException;
        if (r6 == 0) goto L_0x00ec;
    L_0x00eb:
        goto L_0x0107;
    L_0x00ec:
        r6 = r3 instanceof javax.net.ssl.SSLHandshakeException;
        if (r6 == 0) goto L_0x00f9;
    L_0x00f0:
        r7 = r3.getCause();
        r7 = r7 instanceof java.security.cert.CertificateException;
        if (r7 == 0) goto L_0x00f9;
    L_0x00f8:
        goto L_0x0107;
    L_0x00f9:
        r7 = r3 instanceof javax.net.ssl.SSLPeerUnverifiedException;
        if (r7 == 0) goto L_0x00fe;
    L_0x00fd:
        goto L_0x0107;
    L_0x00fe:
        if (r6 != 0) goto L_0x0106;
    L_0x0100:
        r3 = r3 instanceof javax.net.ssl.SSLProtocolException;
        if (r3 == 0) goto L_0x0105;
    L_0x0104:
        goto L_0x0106;
    L_0x0105:
        r4 = 0;
    L_0x0106:
        r5 = r4;
    L_0x0107:
        if (r5 == 0) goto L_0x010b;
    L_0x0109:
        goto L_0x004e;
    L_0x010b:
        throw r1;
    L_0x010c:
        r10 = new java.lang.IllegalStateException;
        r11 = "already connected";
        r10.<init>(r11);
        throw r10;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.b.a.b.a.c.c.e(int, int, int, boolean, c.c.b.a.b.j, c.c.b.a.b.s):void");
    }

    public final void f(int i, int i2, j jVar, s sVar) throws IOException {
        Socket createSocket;
        f fVar = this.c;
        Proxy proxy = fVar.b;
        c.c.b.a.b.b bVar = fVar.a;
        if (proxy.type() == Type.DIRECT || proxy.type() == Type.HTTP) {
            createSocket = bVar.c.createSocket();
        } else {
            createSocket = new Socket(proxy);
        }
        this.d = createSocket;
        InetSocketAddress inetSocketAddress = this.c.c;
        Objects.requireNonNull(sVar);
        this.d.setSoTimeout(i2);
        try {
            c.c.b.a.b.a.i.e.a.i(this.d, this.c.c, i);
            try {
                this.i = new r(o.d(this.d));
                this.j = new c.c.b.a.a.q(o.a(this.d));
            } catch (NullPointerException e) {
                if ("throw with null exception".equals(e.getMessage())) {
                    throw new IOException(e);
                }
            }
        } catch (ConnectException e2) {
            StringBuilder g = c.b.a.a.a.g("Failed to connect to ");
            g.append(this.c.c);
            ConnectException connectException = new ConnectException(g.toString());
            connectException.initCause(e2);
            throw connectException;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:90:0x01f0 A:{Catch:{ all -> 0x01e1 }} */
    /* JADX WARNING: Removed duplicated region for block: B:88:0x01ea A:{Catch:{ all -> 0x01e1 }} */
    /* JADX WARNING: Removed duplicated region for block: B:93:0x01f4  */
    public final void g(c.c.b.a.b.a.c.b r8, c.c.b.a.b.j r9, c.c.b.a.b.s r10) throws java.io.IOException {
        /*
        r7 = this;
        r9 = c.c.b.a.b.a0.HTTP_1_1;
        r0 = r7.c;
        r0 = r0.a;
        r0 = r0.i;
        if (r0 != 0) goto L_0x0011;
    L_0x000a:
        r7.g = r9;
        r8 = r7.d;
        r7.e = r8;
        return;
    L_0x0011:
        java.util.Objects.requireNonNull(r10);
        r10 = r7.c;
        r10 = r10.a;
        r0 = r10.i;
        r1 = 0;
        r2 = r7.d;	 Catch:{ AssertionError -> 0x01e3 }
        r3 = r10.a;	 Catch:{ AssertionError -> 0x01e3 }
        r4 = r3.d;	 Catch:{ AssertionError -> 0x01e3 }
        r3 = r3.e;	 Catch:{ AssertionError -> 0x01e3 }
        r5 = 1;
        r0 = r0.createSocket(r2, r4, r3, r5);	 Catch:{ AssertionError -> 0x01e3 }
        r0 = (javax.net.ssl.SSLSocket) r0;	 Catch:{ AssertionError -> 0x01e3 }
        r8 = r8.a(r0);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r2 = r8.b;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        if (r2 == 0) goto L_0x003d;
    L_0x0032:
        r2 = c.c.b.a.b.a.i.e.a;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r3 = r10.a;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r3 = r3.d;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r4 = r10.e;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r2.j(r0, r3, r4);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
    L_0x003d:
        r0.startHandshake();	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r2 = r0.getSession();	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r2 = c.c.b.a.b.u.a(r2);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r3 = r10.j;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r4 = r10.a;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r4 = r4.d;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r6 = r0.getSession();	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r3 = r3.verify(r4, r6);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r4 = 0;
        if (r3 == 0) goto L_0x0191;
    L_0x0059:
        r3 = r10.k;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = r10.a;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = r10.d;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r6 = r2.c;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r3.b(r10, r6);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = r8.b;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        if (r8 == 0) goto L_0x006e;
    L_0x0068:
        r8 = c.c.b.a.b.a.i.e.a;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r1 = r8.d(r0);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
    L_0x006e:
        r7.e = r0;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = c.c.b.a.a.o.d(r0);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = new c.c.b.a.a.r;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10.m7921init(r8);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r7.i = r10;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = r7.e;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = c.c.b.a.a.o.a(r8);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = new c.c.b.a.a.q;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10.m7920init(r8);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r7.j = r10;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r7.f = r2;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        if (r1 == 0) goto L_0x0090;
    L_0x008c:
        r9 = c.c.b.a.b.a0.a(r1);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
    L_0x0090:
        r7.g = r9;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = c.c.b.a.b.a.i.e.a;
        r8.l(r0);
        r8 = r7.g;
        r9 = c.c.b.a.b.a0.HTTP_2;
        if (r8 != r9) goto L_0x0190;
    L_0x009d:
        r8 = r7.e;
        r8.setSoTimeout(r4);
        r8 = new c.c.b.a.b.a.h.g$c;
        r8.m901init(r5);
        r9 = r7.e;
        r10 = r7.c;
        r10 = r10.a;
        r10 = r10.a;
        r10 = r10.d;
        r0 = r7.i;
        r1 = r7.j;
        r8.a = r9;
        r8.b = r10;
        r8.c = r0;
        r8.d = r1;
        r8.e = r7;
        r9 = new c.c.b.a.b.a.h.g;
        r9.m905init(r8);
        r7.h = r9;
        r8 = r9.p;
        monitor-enter(r8);
        r10 = r8.e;	 Catch:{ all -> 0x018d }
        if (r10 != 0) goto L_0x0185;
    L_0x00cd:
        r10 = r8.b;	 Catch:{ all -> 0x018d }
        if (r10 != 0) goto L_0x00d3;
    L_0x00d1:
        monitor-exit(r8);
        goto L_0x0101;
    L_0x00d3:
        r10 = c.c.b.a.b.a.h.r.g;	 Catch:{ all -> 0x018d }
        r0 = java.util.logging.Level.FINE;	 Catch:{ all -> 0x018d }
        r0 = r10.isLoggable(r0);	 Catch:{ all -> 0x018d }
        if (r0 == 0) goto L_0x00f0;
    L_0x00dd:
        r0 = ">> CONNECTION %s";
        r1 = new java.lang.Object[r5];	 Catch:{ all -> 0x018d }
        r2 = c.c.b.a.b.a.h.e.a;	 Catch:{ all -> 0x018d }
        r2 = r2.t();	 Catch:{ all -> 0x018d }
        r1[r4] = r2;	 Catch:{ all -> 0x018d }
        r0 = c.c.b.a.b.a.e.i(r0, r1);	 Catch:{ all -> 0x018d }
        r10.fine(r0);	 Catch:{ all -> 0x018d }
    L_0x00f0:
        r10 = r8.a;	 Catch:{ all -> 0x018d }
        r0 = c.c.b.a.b.a.h.e.a;	 Catch:{ all -> 0x018d }
        r0 = r0.w();	 Catch:{ all -> 0x018d }
        r10.y(r0);	 Catch:{ all -> 0x018d }
        r10 = r8.a;	 Catch:{ all -> 0x018d }
        r10.flush();	 Catch:{ all -> 0x018d }
        monitor-exit(r8);
    L_0x0101:
        r8 = r9.p;
        r10 = r9.l;
        monitor-enter(r8);
        r0 = r8.e;	 Catch:{ all -> 0x0182 }
        if (r0 != 0) goto L_0x017a;
    L_0x010a:
        r0 = r10.a;	 Catch:{ all -> 0x0182 }
        r0 = java.lang.Integer.bitCount(r0);	 Catch:{ all -> 0x0182 }
        r0 = r0 * 6;
        r1 = 4;
        r8.a(r4, r0, r1, r4);	 Catch:{ all -> 0x0182 }
        r0 = 0;
    L_0x0117:
        r2 = 10;
        if (r0 >= r2) goto L_0x0143;
    L_0x011b:
        r2 = r5 << r0;
        r3 = r10.a;	 Catch:{ all -> 0x0182 }
        r2 = r2 & r3;
        if (r2 == 0) goto L_0x0124;
    L_0x0122:
        r2 = 1;
        goto L_0x0125;
    L_0x0124:
        r2 = 0;
    L_0x0125:
        if (r2 != 0) goto L_0x0128;
    L_0x0127:
        goto L_0x0140;
    L_0x0128:
        if (r0 != r1) goto L_0x012c;
    L_0x012a:
        r2 = 3;
        goto L_0x0132;
    L_0x012c:
        r2 = 7;
        if (r0 != r2) goto L_0x0131;
    L_0x012f:
        r2 = 4;
        goto L_0x0132;
    L_0x0131:
        r2 = r0;
    L_0x0132:
        r3 = r8.a;	 Catch:{ all -> 0x0182 }
        r3.g(r2);	 Catch:{ all -> 0x0182 }
        r2 = r8.a;	 Catch:{ all -> 0x0182 }
        r3 = r10.b;	 Catch:{ all -> 0x0182 }
        r3 = r3[r0];	 Catch:{ all -> 0x0182 }
        r2.e(r3);	 Catch:{ all -> 0x0182 }
    L_0x0140:
        r0 = r0 + 1;
        goto L_0x0117;
    L_0x0143:
        r10 = r8.a;	 Catch:{ all -> 0x0182 }
        r10.flush();	 Catch:{ all -> 0x0182 }
        monitor-exit(r8);
        r8 = r9.l;
        r8 = r8.b();
        r10 = 65535; // 0xffff float:9.1834E-41 double:3.23786E-319;
        if (r8 == r10) goto L_0x015b;
    L_0x0154:
        r0 = r9.p;
        r8 = r8 - r10;
        r1 = (long) r8;
        r0.k(r4, r1);
    L_0x015b:
        r8 = new java.lang.Thread;
        r9 = r9.q;
        r8.<init>(r9);
        r9 = "tt_pangle_thread_http2_connection";
        r9 = c.b.a.a.a.g(r9);
        r0 = android.os.SystemClock.uptimeMillis();
        r9.append(r0);
        r9 = r9.toString();
        r8.setName(r9);
        r8.start();
        goto L_0x0190;
    L_0x017a:
        r9 = new java.io.IOException;	 Catch:{ all -> 0x0182 }
        r10 = "closed";
        r9.<init>(r10);	 Catch:{ all -> 0x0182 }
        throw r9;	 Catch:{ all -> 0x0182 }
    L_0x0182:
        r9 = move-exception;
        monitor-exit(r8);
        throw r9;
    L_0x0185:
        r9 = new java.io.IOException;	 Catch:{ all -> 0x018d }
        r10 = "closed";
        r9.<init>(r10);	 Catch:{ all -> 0x018d }
        throw r9;	 Catch:{ all -> 0x018d }
    L_0x018d:
        r9 = move-exception;
        monitor-exit(r8);
        throw r9;
    L_0x0190:
        return;
    L_0x0191:
        r8 = r2.c;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = r8.get(r4);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = (java.security.cert.X509Certificate) r8;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r9 = new javax.net.ssl.SSLPeerUnverifiedException;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r1 = new java.lang.StringBuilder;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r1.<init>();	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r2 = "Hostname ";
        r1.append(r2);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = r10.a;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = r10.d;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r1.append(r10);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = " not verified:\n    certificate: ";
        r1.append(r10);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = c.c.b.a.b.k.a(r8);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r1.append(r10);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = "\n    DN: ";
        r1.append(r10);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = r8.getSubjectDN();	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = r10.getName();	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r1.append(r10);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r10 = "\n    subjectAltNames: ";
        r1.append(r10);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = c.c.b.a.b.a.k.e.a(r8);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r1.append(r8);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r8 = r1.toString();	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        r9.<init>(r8);	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
        throw r9;	 Catch:{ AssertionError -> 0x01de, all -> 0x01dc }
    L_0x01dc:
        r8 = move-exception;
        goto L_0x01f2;
    L_0x01de:
        r8 = move-exception;
        r1 = r0;
        goto L_0x01e4;
    L_0x01e1:
        r8 = move-exception;
        goto L_0x01f1;
    L_0x01e3:
        r8 = move-exception;
    L_0x01e4:
        r9 = c.c.b.a.b.a.e.q(r8);	 Catch:{ all -> 0x01e1 }
        if (r9 == 0) goto L_0x01f0;
    L_0x01ea:
        r9 = new java.io.IOException;	 Catch:{ all -> 0x01e1 }
        r9.<init>(r8);	 Catch:{ all -> 0x01e1 }
        throw r9;	 Catch:{ all -> 0x01e1 }
    L_0x01f0:
        throw r8;	 Catch:{ all -> 0x01e1 }
    L_0x01f1:
        r0 = r1;
    L_0x01f2:
        if (r0 == 0) goto L_0x01f9;
    L_0x01f4:
        r9 = c.c.b.a.b.a.i.e.a;
        r9.l(r0);
    L_0x01f9:
        c.c.b.a.b.a.e.o(r0);
        throw r8;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.b.a.b.a.c.c.g(c.c.b.a.b.a.c.b, c.c.b.a.b.j, c.c.b.a.b.s):void");
    }

    public boolean h(c.c.b.a.b.b bVar, f fVar) {
        if (this.n.size() < this.m && !this.k) {
            c.c.b.a.b.a.b bVar2 = c.c.b.a.b.a.b.a;
            c.c.b.a.b.b bVar3 = this.c.a;
            Objects.requireNonNull((z.a) bVar2);
            if (!bVar3.a(bVar)) {
                return false;
            }
            if (bVar.a.d.equals(this.c.a.a.d)) {
                return true;
            }
            if (this.h == null || fVar == null || fVar.b.type() != Type.DIRECT || this.c.b.type() != Type.DIRECT || !this.c.c.equals(fVar.c) || fVar.a.j != c.c.b.a.b.a.k.e.a || !i(bVar.a)) {
                return false;
            }
            try {
                bVar.k.b(bVar.a.d, this.f.c);
                return true;
            } catch (SSLPeerUnverifiedException unused) {
            }
        }
        return false;
    }

    public boolean i(w wVar) {
        int i = wVar.e;
        w wVar2 = this.c.a.a;
        boolean z = false;
        if (i != wVar2.e) {
            return false;
        }
        if (wVar.d.equals(wVar2.d)) {
            return true;
        }
        u uVar = this.f;
        if (uVar != null && c.c.b.a.b.a.k.e.a.d(wVar.d, (X509Certificate) uVar.c.get(0))) {
            z = true;
        }
        return z;
    }

    public boolean j() {
        return this.h != null;
    }

    public String toString() {
        StringBuilder g = c.b.a.a.a.g("Connection{");
        g.append(this.c.a.a.d);
        g.append(":");
        g.append(this.c.a.a.e);
        g.append(", proxy=");
        g.append(this.c.b);
        g.append(" hostAddress=");
        g.append(this.c.c);
        g.append(" cipherSuite=");
        u uVar = this.f;
        g.append(uVar != null ? uVar.b : "none");
        g.append(" protocol=");
        g.append(this.g);
        g.append('}');
        return g.toString();
    }
}
